# 配置 linux zlib 模块
function(android_config_openssl_function)
    if("${ANDROID_ABI}" STREQUAL "armeabi-v7a")
        set(OPENSSL_ARCH "android-arm")
    elseif("${ANDROID_ABI}" STREQUAL "arm64-v8a")
        set(OPENSSL_ARCH "android-arm64")
    elseif("${ANDROID_ABI}" STREQUAL "x86")
        set(OPENSSL_ARCH "android-x86")
    elseif("${ANDROID_ABI}" STREQUAL "x86_64")
        set(OPENSSL_ARCH "android-x86_64")
    endif()
    # 写入缓存，全局可用
    set(OPENSSL_CONFIGURE
        env ANDROID_NDK_ROOT=${CMAKE_FIND_ROOT_PATH}
        env PATH=${TOOLCHAIN_PREFIX}:/usr/bin
        <SOURCE_DIR>/Configure
        ${OPENSSL_ARCH}
        -D__ANDROID_API__=${ANDROID_PLATFORM}
    CACHE STRING "openssl configure" FORCE)
    # 构建命令
    set(OPENSSL_BUILD_COMMAND
        env ANDROID_NDK_ROOT=${CMAKE_FIND_ROOT_PATH}
        env PATH=${TOOLCHAIN_PREFIX}:/usr/bin
        make -j${NPROC}
    CACHE STRING "openssl build command" FORCE
    )
endfunction()
android_config_openssl_function()